<?php

declare(strict_types=1);

namespace app\admin\validate;

use app\common\Validate;

class MysqlValidate extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        "table" => ["require", "length" => "2,30"],
        "comment" => ["require", "length" => "2,100"]
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        "table.require" => "不可为空",
        "table.length" => "长度必须2~30个字符",
        "comment.require" => "不可为空",
        "comment.length" => "长度必须2~100个字符",
    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'add'  => ["table", "comment"],
        'edit' => ["table", "comment"],
    ];
}
